﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Xps.Packaging;
using System.IO;
using System.Windows.Documents;
using System.IO.Packaging;
using System.Windows.Xps.Serialization;

namespace NUMIMAX
{
    public class k_xps
    {
        public  XpsDocument openFile(string _path)
        {
            XpsDocument doc = new XpsDocument(_path, FileAccess.Read);
            return doc;
        }

        public static void SaveAsXps(string path, FlowDocument document)
        {
            using (Package package = Package.Open(path, FileMode.Create))
            {
                using (var xpsDoc = new XpsDocument(
                    package, System.IO.Packaging.CompressionOption.Maximum))
                {
                    var xpsSm = new XpsSerializationManager(
                        new XpsPackagingPolicy(xpsDoc), false);
                    DocumentPaginator dp =
                        ((IDocumentPaginatorSource)document).DocumentPaginator;
                    xpsSm.SaveAsXaml(dp);
                }
            }
        }
        //musze sie dowiedziec jak to sie robi i zrobić 

        //public XpsDocument create(object _path)
        //{
           
        //   // return doc;
        //}

    }
}
